Aim (aim):
A map representation of an ancient city with the oldest locations.
Visual Design Type (vistype):
World projection with dots.
Visual Mappings (vismapping):
Points are represented depending on latitude and longitude
Tooltip to see the oldest date along with period names
Highlighting all other points with the same oldest date.
Data Preparation (dataprep):
I have sorted the data set depending on the minimum date. And took all the data that had the minimum date < -400 Improvements (improvements):
It's hard to determine each location as there are a lot of settlements(e.g. Italy) An improvement could be to make the map zoomable
import altair as alt
import pandas as pd
from vega_datasets import data
# data generators for background
sphere = alt.sphere()
graticule = alt.graticule()
#import data and map
alt.data_transformers.disable_max_rows()
source = alt.topo_feature(data.world_110m.url, 'countries')
data = pd.read_csv('Prehistory.csv')
background = alt.Chart(source).mark_geoshape(
fill='lightgray',
stroke='black'
).project(
type= 'mercator',
center = [10,40],
scale=500,
).properties(
title='Oldest settlements in prehistory',
width=800,
height=600,
)
highlight = alt.selection_single(on='mouseover', fields=['minDate'], empty='none')
points = alt.Chart(data).mark_circle(
size=9,
color='steelblue'
).encode(
longitude='reprLong:Q',
latitude='reprLat:Q',
tooltip=[alt.Tooltip
('featureType', title="Type of settlement"),
alt.Tooltip
('reprLong', title="Longitudinal coordinate"),
alt.Tooltip
('reprLat', title="Latitudinal coordinate"),
alt.Tooltip
('description', title="description"),
alt.Tooltip
('minDate', title="Starting year")
],
color=alt.condition(highlight, alt.value('red'),
'minDate:Q',
title = "Starting year",
scale=alt.Scale(scheme='greens'))
).add_selection(
highlight
).project(
scale = 500,
center = [10,40],
)
background + points